package org.ktm.quantity;

/*
 * The SystemOfUnits represents a set of related Units defined by a 
 * standard such as SI
 */
public final class SystemOfUnits {

    private static SystemOfUnits theInstance = null;
    public static SIBaseUnit[]   units       = {
                                             getInstance().METER, getInstance().KILOGRAM, getInstance().MILLILITER, getInstance().BATH, getInstance().BOX, getInstance().BOTTLE, getInstance().CASE
                                             };

    public static SystemOfUnits getInstance() {
        if (theInstance == null) {
            theInstance = new SystemOfUnits();
        }
        return theInstance;
    }

    public static Metric parse(String unit) {
        for (int i = 0; i < units.length; i++) {
            if (units[i].getMetricName().equals(unit)) { return units[i]; }
        }
        return null;
    }

    public String getNameOfSystem() {
        return "SI";
    }

    public String getNameOfStandardizationBody() {
        return "BIPM";
    }

    public final SIBaseUnit METER      = new Meter();
    public final SIBaseUnit KILOGRAM   = new Kilogram();
    public final SIBaseUnit BATH       = new Bath();
    public final SIBaseUnit BOX        = new Box();
    public final SIBaseUnit BOTTLE     = new Bottle();
    public final SIBaseUnit CASE       = new Case();
    public final SIBaseUnit MILLILITER = new Milliliter();

}
